<?php
	/**
	 * 城市表模型
	 */
	class CityModel extends Model{
		
		//查询所有的省份
		public function getAllProvince(){
			
			$province = $this->table('province')->all();
//			var_dump($province);
			return $province;
		}
		//查询相应省份的城市
		public function getProvCity($proId){
			$city = $this->table('city')->where("prov_id={$proId}")->all();
			return $city;
		}
		/**
		 * 查询相应城市的地区县
		 */
		 public function getDist($cityid){
		 	$dists = $this->table('district')->where("city_id={$cityid}")->all();
			return $dists;
		 }
		 
		 /**
		  * 返回一个数组
		  * city 表示当前省份的城市
		  * dist 表示当前城市高的县或区
		  */
		  public function getCityDist($cd){
			//当前省份
			$provId = $cd[0];
			//当前城市
			$cityId = $cd[1];
			//返回当前的
			$city['prov'] = $this->getAllProvince();
			$city['city'] = $this->table('city')->where("prov_id={$provId}")->all();
			$city['dist'] = $this->table('district')->where("city_id={$cityId}")->all();
			return $city;
		  }
		 
		 
	}
